﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;

/// <summary>
/// Summary description for LogowanieRejestracja
/// </summary>
public class LogowanieInterface
{
    Panel panMain;
    public Button btnLogin, btnLogout;
    TextBox txtUsername, txtPassword;
    Label lbUserName;
    static string interfaceType = "login";
    static string userName = null;
    static int userID = -1;

	public LogowanieInterface(Panel panMain)
	{
        this.panMain = panMain;
	}
  
    public void Draw()
    {
        switch(interfaceType)
        {
        
            case "login":

                 Label user, password;
                user = new Label();
                 password = new Label();
                 btnLogin = new Button();
                 txtUsername = new TextBox();
                 txtPassword = new TextBox();

                 btnLogin.Text = "login";
                 txtPassword.TextMode = TextBoxMode.Password;
                 user.Text = "Username";
                 password.Text = "Password";

                 panMain.Controls.Add(user);
                 panMain.Controls.Add(txtUsername);
                 panMain.Controls.Add(password);
                 panMain.Controls.Add(txtPassword);
                 panMain.Controls.Add(btnLogin);
            break;
            default:
                lbUserName = new Label();
                lbUserName.Text = userName;
                btnLogout = new Button();

                 btnLogout.Text = "logout";

                 panMain.Controls.Add(lbUserName);
                 panMain.Controls.Add(btnLogout);
            break;
     }
    }
    public void DrawLogout(string userName)
    {
        lbUserName = new Label();
        lbUserName.Text = userName;
        btnLogout = new Button();

        btnLogout.Text = "logout";

        panMain.Controls.Add(lbUserName);
        panMain.Controls.Add(btnLogout);
    }

    public string GetSetUsernameText { get { return txtUsername.Text; } set { txtUsername.Text = value; } }
    public string GetSetPasswordText { get { return txtPassword.Text; } set { txtPassword.Text = value; } }
    public string GetSetUserName { get { return userName; } set { userName = value; } }
    public string GetSetUserInterface { get { return interfaceType; } set { interfaceType = value; } }
    public int GetSetUserID { get { return userID; } set { userID = value; } }

}